package com.xbongbong.saas.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zheng.li
 * @version v1.0
 * @date 2019/3/5 15:30
 * @since v1.0
 */
@Getter
public enum PrintMenuEnum {
    /**
     * 合同
     */
    CONTRACT(XbbRefTypeEnum.CONTRACT.getCode(), XbbRefTypeEnum.CONTRACT.getAlias(), XbbRefTypeEnum.CONTRACT.getI18nName()),
    /**
     * 退货退款
     */
    REFUND(XbbRefTypeEnum.REFUND.getCode(), XbbRefTypeEnum.REFUND.getAlias(), XbbRefTypeEnum.REFUND.getI18nName()),
    /**
     * 机会
     */
    OPPORTUNITY(XbbRefTypeEnum.SALES_OPPORTUNITY.getCode(), XbbRefTypeEnum.SALES_OPPORTUNITY.getAlias(), XbbRefTypeEnum.SALES_OPPORTUNITY.getI18nName()),
    /**
     * 工作报告
     */
    WORK_REPORT(XbbRefTypeEnum.WORK_REPORT.getCode(), XbbRefTypeEnum.WORK_REPORT.getAlias(), XbbRefTypeEnum.WORK_REPORT.getI18nName()),
    /**
     * 报价单
     */
    QUOTATION(XbbRefTypeEnum.QUOTATION.getCode(), XbbRefTypeEnum.QUOTATION.getAlias(), XbbRefTypeEnum.QUOTATION.getI18nName()),
    /**
     * 采购合同
     */
    PURCHASE(XbbRefTypeEnum.PURCHASE.getCode(), XbbRefTypeEnum.PURCHASE.getAlias(), XbbRefTypeEnum.PURCHASE.getI18nName()),
    /**
     * 采购退货单
     */
    RETURNED_PURCHASE(XbbRefTypeEnum.RETURNED_PURCHASE.getCode(), XbbRefTypeEnum.RETURNED_PURCHASE.getAlias(), XbbRefTypeEnum.RETURNED_PURCHASE.getI18nName()),
    /**
     * 入库单
     */
//    INSTOCK(XbbRefTypeEnum.INSTOCK.getCode(), XbbRefTypeEnum.INSTOCK.getAlias(), XbbRefTypeEnum.INSTOCK.getI18nName()),
    /**
     * 采购入库单
     */
    PURCHASE_INSTOCK(XbbRefTypeEnum.PURCHASE_INSTOCK.getCode(), XbbRefTypeEnum.PURCHASE_INSTOCK.getAlias(), XbbRefTypeEnum.PURCHASE_INSTOCK.getI18nName()),
    /**
     * 销售退货入库单
     */
    REFUND_INSTOCK(XbbRefTypeEnum.REFUND_INSTOCK.getCode(), XbbRefTypeEnum.REFUND_INSTOCK.getAlias(), XbbRefTypeEnum.PURCHASE_INSTOCK.getI18nName()),
    /**
     * 生产入库单
     */
    PRODUCTION_INSTOCK(XbbRefTypeEnum.PRODUCTION_INSTOCK.getCode(), XbbRefTypeEnum.PRODUCTION_INSTOCK.getAlias(), XbbRefTypeEnum.PRODUCTION_INSTOCK.getI18nName()),
    /**
     * 生产退料单
     */
    RETURNED_MATERIEL_INSTOCK(XbbRefTypeEnum.RETURNED_MATERIEL_INSTOCK.getCode(), XbbRefTypeEnum.RETURNED_MATERIEL_INSTOCK.getAlias(), XbbRefTypeEnum.RETURNED_MATERIEL_INSTOCK.getI18nName()),
    /**
     * 其他入库单
     */
    OTHER_INSTOCK(XbbRefTypeEnum.OTHER_INSTOCK.getCode(), XbbRefTypeEnum.OTHER_INSTOCK.getAlias(), XbbRefTypeEnum.OTHER_INSTOCK.getI18nName()),
    /**
     * 出库单
     */
//    OUTSTOCK(XbbRefTypeEnum.OUTSTOCK.getCode(), XbbRefTypeEnum.OUTSTOCK.getAlias(), XbbRefTypeEnum.OUTSTOCK.getI18nName()),
    /**
     * 工单出库单
     */
    WORK_ORDER_OUTSTOCK(XbbRefTypeEnum.WORK_ORDER_OUTSTOCK.getCode(), XbbRefTypeEnum.WORK_ORDER_OUTSTOCK.getAlias(), XbbRefTypeEnum.WORK_ORDER_OUTSTOCK.getI18nName()),
    /**
     * 销售出库单
     */
    CONTRACT_OUTSTOCK(XbbRefTypeEnum.CONTRACT_OUTSTOCK.getCode(), XbbRefTypeEnum.CONTRACT_OUTSTOCK.getAlias(), XbbRefTypeEnum.CONTRACT_OUTSTOCK.getI18nName()),
    /**
     * 采购退货出库单
     */
    RETURNED_PURCHASE_OUTSTOCK(XbbRefTypeEnum.RETURNED_PURCHASE_OUTSTOCK.getCode(), XbbRefTypeEnum.RETURNED_PURCHASE_OUTSTOCK.getAlias(), XbbRefTypeEnum.RETURNED_PURCHASE_OUTSTOCK.getI18nName()),
    /**
     * 生产量料单
     */
    PRODUCTION_MATERIEL_OUTSTOCK(XbbRefTypeEnum.PRODUCTION_MATERIEL_OUTSTOCK.getCode(), XbbRefTypeEnum.PRODUCTION_MATERIEL_OUTSTOCK.getAlias(), XbbRefTypeEnum.PRODUCTION_MATERIEL_OUTSTOCK.getI18nName()),
    /**
     * 其他出库单
     */
    OTHER_OUTSTOCK(XbbRefTypeEnum.OTHER_OUTSTOCK.getCode(), XbbRefTypeEnum.OTHER_OUTSTOCK.getAlias(), XbbRefTypeEnum.OTHER_OUTSTOCK.getI18nName()),
    /**
     * 盘点单
     */
    INVENTORY(XbbRefTypeEnum.INVENTORY.getCode(), XbbRefTypeEnum.INVENTORY.getAlias(), XbbRefTypeEnum.INVENTORY.getI18nName()),
    /**
     * 调拨单
     */
    TRANSFER(XbbRefTypeEnum.TRANSFER.getCode(), XbbRefTypeEnum.TRANSFER.getAlias(), XbbRefTypeEnum.TRANSFER.getI18nName()),
    /**
     * 装配出入库单
     */
    ASSEMBLE(XbbRefTypeEnum.ASSEMBLE.getCode(), XbbRefTypeEnum.ASSEMBLE.getAlias(), XbbRefTypeEnum.ASSEMBLE.getI18nName()),
    /**
     * BOM清单
     */
    BOM_BILL(XbbRefTypeEnum.BOM_BILL.getCode(), XbbRefTypeEnum.BOM_BILL.getAlias(), XbbRefTypeEnum.BOM_BILL.getI18nName()),
    /**
     * 生产单
     */
    PRODUCTION_ORDER(XbbRefTypeEnum.PRODUCTION_ORDER.getCode(),XbbRefTypeEnum.PRODUCTION_ORDER.getAlias(),XbbRefTypeEnum.PRODUCTION_ORDER.getI18nName()),
    /**
     * 应收款
     */
    PAYMENT(XbbRefTypeEnum.PAYMENT.getCode(),XbbRefTypeEnum.PAYMENT.getAlias(),XbbRefTypeEnum.PAYMENT.getI18nName()),
    /**
     * 回款单
     */
    PAYMENT_SHEET(XbbRefTypeEnum.PAYMENT_SHEET.getCode(),XbbRefTypeEnum.PAYMENT_SHEET.getAlias(),XbbRefTypeEnum.PAYMENT_SHEET.getI18nName()),
    /**
     * 进项发票
     */
    PURCHASE_INVOICE(XbbRefTypeEnum.PURCHASE_INVOICE.getCode(),XbbRefTypeEnum.PURCHASE_INVOICE.getAlias(),XbbRefTypeEnum.PURCHASE_INVOICE.getI18nName()),
    /**
     * 销项发票
     */
    INVOICE(XbbRefTypeEnum.INVOICE.getCode(),XbbRefTypeEnum.INVOICE.getAlias(),XbbRefTypeEnum.INVOICE.getI18nName()),
    /**
     * 付款单
     */
    PAY_SHEET(XbbRefTypeEnum.PAY_SHEET.getCode(),XbbRefTypeEnum.PAY_SHEET.getAlias(),XbbRefTypeEnum.PAY_SHEET.getI18nName()),
    /**
     * 付款计划
     */
    PAY_PLAN(XbbRefTypeEnum.PAY_PLAN.getCode(),XbbRefTypeEnum.PAY_PLAN.getAlias(),XbbRefTypeEnum.PAY_PLAN.getI18nName()),
    /**
     * 工单
     */
    WORK_ORDER(XbbRefTypeEnum.WORK_ORDER.getCode(),XbbRefTypeEnum.WORK_ORDER.getAlias(),XbbRefTypeEnum.WORK_ORDER.getI18nName()),

    /**
     * 客户对账单
     */
    CUSTOMER_STATEMENT(XbbRefTypeEnum.CUSTOMER_STATEMENT.getCode(),XbbRefTypeEnum.CUSTOMER_STATEMENT.getAlias(),XbbRefTypeEnum.CUSTOMER_STATEMENT.getI18nName()),

    /**
     * 其他收入单
     */
    OTHER_INCOME(XbbRefTypeEnum.OTHER_INCOME.getCode(), XbbRefTypeEnum.OTHER_INCOME.getAlias(), XbbRefTypeEnum.OTHER_INCOME.getI18nName()),

    /**
     * 其他支出单
     */
    OTHER_EXPENSE(XbbRefTypeEnum.OTHER_EXPENSE.getCode(), XbbRefTypeEnum.OTHER_EXPENSE.getAlias(), XbbRefTypeEnum.OTHER_EXPENSE.getI18nName()),

    /**
     * 资金调拨单
     */
    FUND_TRANSFER(XbbRefTypeEnum.FUND_TRANSFER.getCode(), XbbRefTypeEnum.FUND_TRANSFER.getAlias(), XbbRefTypeEnum.FUND_TRANSFER.getI18nName()),

    /**
     * 成本调整单
     */
    COST_ADJUST(XbbRefTypeEnum.COST_ADJUST.getCode(), XbbRefTypeEnum.COST_ADJUST.getAlias(), XbbRefTypeEnum.COST_ADJUST.getI18nName()),

    /**
     * 工单
     */
    WORK_ORDER_V2(XbbRefTypeEnum.WORK_ORDER_V2.getCode(), XbbRefTypeEnum.WORK_ORDER_V2.getAlias(), XbbRefTypeEnum.WORK_ORDER_V2.getI18nName()),

    /**
     * 回执单
     */
    RECEIPT_ORDER(XbbRefTypeEnum.RECEIPT_ORDER.getCode(), XbbRefTypeEnum.RECEIPT_ORDER.getAlias(), XbbRefTypeEnum.RECEIPT_ORDER.getI18nName()),

    /**
     * 竞争对手
     */
    COMPETITOR(XbbRefTypeEnum.COMPETITOR.getCode(),XbbRefTypeEnum.COMPETITOR.getAlias(),XbbRefTypeEnum.COMPETITOR.getI18nName())
    ;
    private int code;
    private String alias;
    private String name;

    PrintMenuEnum(int code, String alias, String name) {
        this.code = code;
        this.alias = alias;
        this.name = name;
    }


    public static List<PrintMenuEnum> getAllEnum() {
        List<PrintMenuEnum> list = new ArrayList<>();
        for (PrintMenuEnum cache : values()) {
            list.add(cache);
        }
        return list;
    }

    public static PrintMenuEnum getByAlias(String alias) {
        for (PrintMenuEnum cacheCode : values()) {
            if (cacheCode.getAlias().equals(alias)) {
                return cacheCode;
            }
        }
        return null;
    }

    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }
}
